<?php namespace App\Http\Controllers\Site;

use App\Http\Controllers\Controller;
use App\Item;
use DB;

class IndexController extends Controller
{
    public function getIndex()
    {
         $pro_list= Item::where('kind',$kind='Bride makeup')->take(7)->get();
        $pro_lists= Item::where('kind',$kind='Semi-permanent makeup')->take(7)->get();
        $case_list= Item::where('kind',$kind='StarPhoto')->get();
        $team_list= Item::where('kind',$kind='TechnicalTeam')->get();
        $course_list= Item::where('type',$type='course')->take(3)->get();
        $study_list= Item::where('type',$type='study')->get();
        return view('site.index',[
            'study_list'=>$study_list,
            'course_list'=>$course_list,
            'team_list' =>$team_list,
            'case_list' =>$case_list,
            'pro_list'=>$pro_list,
            'pro_lists'=>$pro_lists,
            'param'=>['kind'=>$kind],
            'name'=>'index',
        ]);
    }
    public function getStudy()
        //教学课堂
    {

    }

    public function getTest()
    {
        $items = config('site.items');
        foreach ($items as $itemName => $item) {
            $navs[$itemName]['nav'] = $item['nav'];
            $navs[$itemName]['name'] = $item['name'];
            $navs[$itemName]['itemName'] = $itemName;
            $navs[$itemName]['nav'] = $item['nav'];

            if (1 == $item['nav']) {
                if (isset($item['type'])) {
                    if ($item['data'][$item['type']]['type'] == "dynamic") {
                        $navs[$itemName]['list'] = Item::where('type', $item['data'][$item['type']]['value'])->lists('name', 'id');
                    } else {
                        $navs[$itemName]['list'] = $item['data'][$item['type']]['value'];
                    }
                } else {
                    $navs[$itemName]['list'] = Item::where('type', $itemName)->lists('name', 'id');
                }
            }
        }
        dd($navs);
    }
}